package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.query.QuestionAdminPageQuery;
import com.tianji.learning.domain.vo.QuestionAdminVO;
import com.tianji.learning.domain.vo.QuestionVO;
import com.tianji.learning.service.IInteractionQuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 互动提问的问题表 前端控制器
 * </p>
 *
 * @author LYQ
 * @since 2024-06-25
 */
@Api(tags = "管理端 - 互动问答相关接口")
@RestController
@RequiredArgsConstructor
@RequestMapping("admin/questions")
public class InteractionAdminQuestionController {
    private final IInteractionQuestionService questionService;

    /**
     * 管理端 - 分页查询提问数据
     *
     * @param pageQuery
     * @return
     */
    @GetMapping("/page")
    @ApiOperation("管理端 - 分页查询提问数据")
    public PageDTO<QuestionAdminVO> adminQueryPage(QuestionAdminPageQuery pageQuery) {
        return questionService.adminQueryPage(pageQuery);
    }


    /**
     * 管理端 - 隐藏或显示问题
     *
     * @param id,hidden
     * @return
     */
    @GetMapping("/{id}/hidden/{hidden}")
    @ApiOperation("管理端 - 隐藏或显示问题")
    public void hiddenChange(@PathVariable Long id, @PathVariable Boolean hidden) {
        questionService.hiddenChange(id,hidden);
    }


    /**
     * 管理端 - 根据id查询问题详情
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    @ApiOperation("管理端 - 根据id查询问题详情")
    public QuestionAdminVO adminQueryQuestionById(@PathVariable Long id) {
        return questionService.adminQueryQuestionById(id);
    }
}
